package com.example.a_buffer;

import java.io.*;

public class Demo1PrintStream {
    public static void main(String[] args) {
//        try ( FileReader fr = new FileReader("bc.txt");){
//            int data = fr.read();
//            System.out.println((char)data);
//        } catch (FileNotFoundException e) {
//            throw new RuntimeException(e);
//        } catch (IOException e) {
//            throw new RuntimeException(e);
//        }

        try(FileInputStream fis = new FileInputStream("bc.txt");
            InputStreamReader isr = new InputStreamReader(fis,"GB18030");) {
            int data = isr.read();
            System.out.println((char) data);
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
